import os
import sys
from SeerGlobal import *
from SeerFight import *
task = get_value('Task')
zhan = get_value('Zhan')
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
_path = ''
_path = sys.argv[0]
_path = os.path.dirname(_path)
if _path[-8:] == 'SeerMain':
    _path = str(_path[0:-8])
sys.path.append(_path + '\\List\\HFVSM')#Yoso路径
sys.path.append('./')#当前相对路径
from pyZuanShiWindow import Ui_MainWindow

class ZuanShiWindows(Ui_MainWindow,QMainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.WindowStaysOnTopHint)
        #self.setFixedSize(135,150)
        self.pushButton.clicked.connect(self.click1)#登录游戏
        self.pushButton_2.clicked.connect(self.click2)#捕捉毒特性精灵
        self.pushButton_3.clicked.connect(self.click3)#强化特性
        self.pushButton_4.clicked.connect(self.click4)#天赋培养
        self.pushButton_5.clicked.connect(self.click5)#功勋兑换
        self.pushButton_6.clicked.connect(self.click6)#刻印升级
        self.pushButton_7.clicked.connect(self.click7)#六界神王殿
        self.pushButton_8.clicked.connect(self.click8)#泰坦源脉
        self.pushButton_9.clicked.connect(self.click9)#揍蘑菇怪
        self.pushButton_10.clicked.connect(self.click10)#许愿
        self.pushButton_11.clicked.connect(self.click11)#送巅峰自由
        
        self.switchNum = 0
    def click1(self):
        """登录游戏"""
        self.switchNum = 1
    def click2(self):
        """捕捉毒特性精灵"""
        self.switchNum = 2
    def click3(self):
        """强化特性"""
        self.switchNum = 3
    def click4(self):
        """天赋培养"""
        self.switchNum = 4
    def click5(self):
        """功勋兑换"""
        self.switchNum = 5
    def click6(self):
        """刻印升级"""
        self.switchNum = 6
    def click7(self):
        """六界神王殿"""
        self.switchNum = 7
    def click8(self):
        """泰坦源脉"""
        self.switchNum = 8
    def click9(self):
        """揍蘑菇怪"""
        self.switchNum = 9
    def click10(self):
        """许愿"""
        self.switchNum = 10
    def click11(self):
        """送巅峰自由"""
        self.switchNum = 11
jobw=ZuanShiWindows()
jobw.show()

def job():
    """钻石任务"""
    if jobw.switchNum == 0:
        pass
    elif jobw.switchNum == 1:
        登录()
    elif jobw.switchNum == 2:
        捕捉毒特性精灵()
    elif jobw.switchNum == 3:
        强化特性()
    elif jobw.switchNum == 4:
        精灵养成()
    elif jobw.switchNum == 5:
        功勋兑换()
    elif jobw.switchNum == 6:
        强化刻印()
    elif jobw.switchNum == 7:
        六界神王殿()
    elif jobw.switchNum == 8:
        泰坦源脉()
    elif jobw.switchNum == 9:
        pass
    elif jobw.switchNum == 10:
        许愿()
    elif jobw.switchNum == 11:
        送巅峰自由()
    
def 登录():
    """登录游戏"""
    if(Fun("HFVSM","HFVSM_1") == 1):        #首页--右下淘米图标
        Fun("HFVSM","HFVSM_2")              #点击开始游戏
    
    if(Fun("HFVSM","HFVSM_3") == 1):        #选择账号页--下方黄字(登录)
        Fun("HFVSM","HFVSM_4")              #点击账号
    
    if(Fun("HFVSM","HFVSM_5") == 1):        #输入账号页--中间绿色字(记住)
        Fun("HFVSM","HFVSM_6")              #点击登录
    
    if(Fun("HFVSM","HFVSM_7") == 1):        #选择服务器广告页--最上小飞船图标
        Fun("HFVSM","HFVSM_8")              #点击进入游戏
    
    if(Fun("HFVSM","HFVSM_9") == 1):        #游戏主页--右下角小图标
        Fun("HFVSM","HFVSM_10")             #点击屏蔽角色
    
    if(Fun("HFVSM","HFVSM_93") == 1):       #游戏主页--星愿界面标题字(瓶)
        Fun("HFVSM","HFVSM_94")             #点击叉号关闭

isa=True
捕捉成功 = False
def 捕捉毒特性精灵():
    """捕捉毒特性精灵
        需要Yoso打开相关选项
    """
    global isa
    global 捕捉成功
    if(Fun("HFVSM","HFVSM_27") == 1):           #魔域页--弹窗(捕捉成功)
        Fun("HFVSM","HFVSM_28")                 #点击确认按钮
        捕捉成功 = True
    if 捕捉成功 == True:
        if(Fun("HFVSM","HFVSM_29") == 1):       #魔域页--右下角文字(离开)
            Fun("HFVSM","HFVSM_30")             #点击离开
        if(Fun("HFVSM","HFVSM_31") == 1):       #捕捉活动页--右边文字(任务一)
            Fun("HFVSM","HFVSM_32")             #点击右上角叉号
        if(Fun("HFVSM","HFVSM_33") == 1):       #任何页--弹窗(活动已结束)
            Fun("HFVSM","HFVSM_34")             #点击确认按钮
        return
    
    if(Fun("HFVSM","HFVSM_23") == 1):           #魔域页--捕捉标题文字(捕)
        isa = False                             #如果此时已经到达魔域,就不执行后面的
        if(Fun("HFVSM","HFVSM_17") == 1):       #魔域页--弹窗(Yoso传送)
            Fun("HFVSM","HFVSM_18")             #点击确认按钮
        if(Fun("HFVSM","HFVSM_19",0) == 1):     #前后左右位图,需要Yoso开启功能
            pass
        if(Fun("HFVSM","HFVSM_20",0) == 1):
            pass
        if(Fun("HFVSM","HFVSM_21",0) == 1):
            pass
        if(Fun("HFVSM","HFVSM_22",0) == 1):
            pass
    
    if(Fun("HFVSM","HFVSM_24") == 1):           #战斗页--杰丹残血图标
        Fun("HFVSM","HFVSM_25")                 #点击捕捉
    if(Fun("HFVSM","HFVSM_123") == 1):          #战斗页--杰丹残血图标
        Fun("HFVSM","HFVSM_25")                 #点击捕捉
    if(Fun("HFVSM","HFVSM_26",0) == 1):         #战斗页--捕捉页--点击胶囊
        pass
    
    if isa == True:
        if(Fun("HFVSM","HFVSM_13") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_14")             #点击精灵背包
            return
        
    if(Fun("HFVSM","HFVSM_15") == 1):       #背包页--左下黄字(战)
        if isa == True:                     #保证只会执行一次
            波克尔 = ["12"]
            task.addTask("BeiBao","HFVSM",波克尔)
            isa = False
        x = task.getRunTask("BeiBao")       #检查背包模块是不是已经运行完毕
        if x == None:
            Fun("HFVSM","HFVSM_16")         #点击关闭背包叉号
        else:
            return
    if(Fun("HFVSM","HFVSM_11") == 1):       #游戏主页--左上精灵王者图标
        Fun("HFVSM","HFVSM_12")             #点击精灵王者

是否强化 = False
def 强化特性():
    """强化特性"""
    global 是否强化
    if(Fun("HFVSM","HFVSM_39") != 1):       #太空站页--好友图标上方的小区域
        if(Fun("HFVSM","HFVSM_35") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_36")             #点击星际地图
        if(Fun("HFVSM","HFVSM_37") == 1):       #地图页--太空站图标
            Fun("HFVSM","HFVSM_38")             #点击进入太空站
    elif(Fun("HFVSM","HFVSM_39") == 1):
        if 是否强化 == False:
            Fun("HFVSM","HFVSM_40")                 #点击强化特性器
    
    if(Fun("HFVSM","HFVSM_42") == 1):       #特性强化页--中间文字(灵)
        if(Fun("HFVSM","HFVSM_41",0) == 1):     #寻找杰丹图标并点击
            pass
    if(Fun("HFVSM","HFVSM_43") == 1):       #特性强化页--一星特性图标
        Fun("HFVSM","HFVSM_44")             #点击强化特性
    if(Fun("HFVSM","HFVSM_45") == 1):       #特性强化页--弹窗(确认强化吗)
        Fun("HFVSM","HFVSM_46")             #点击确认按钮
    if(Fun("HFVSM","HFVSM_47") == 1):       #特性强化页--弹窗(强化成功)
        Fun("HFVSM","HFVSM_48")             #点击确认按钮
    if(Fun("HFVSM","HFVSM_49") == 1):       #特性强化页--一星特性图标(亮)
        Fun("HFVSM","HFVSM_50")             #点击叉号
        是否强化 = True
    
是否兑换 = False
def 功勋兑换():
    """功勋兑换"""
    global 是否兑换
    if(Fun("HFVSM","HFVSM_39") != 1):       #太空站页--好友图标上方的小区域
        if(Fun("HFVSM","HFVSM_35") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_36")             #点击星际地图
        if(Fun("HFVSM","HFVSM_37") == 1):       #地图页--太空站图标
            Fun("HFVSM","HFVSM_38")             #点击进入太空站
    elif(Fun("HFVSM","HFVSM_39") == 1):
        if 是否兑换 == False:
            Fun("HFVSM","HFVSM_51")             #点击功勋兑换活动
    
    if(Fun("HFVSM","HFVSM_52") == 1):       #功勋兑换页--下方黄字(功勋)
        if 是否兑换 == False:
            Fun("HFVSM","HFVSM_53")             #点击前往兑换
        else:
            Fun("HFVSM","HFVSM_58")             #点击叉号关闭
    
    if(Fun("HFVSM","HFVSM_56") == 1):       #功勋兑换页--弹窗(已经放入存储库)
        Fun("HFVSM","HFVSM_57")             #点击确认按钮
        是否兑换 = True
    
    if(Fun("HFVSM","HFVSM_54") == 1):       #功勋兑换页--还原药剂图标
        if 是否兑换 == False:
            Fun("HFVSM","HFVSM_55")             #点击兑换
        else:
            Fun("HFVSM","HFVSM_58")             #点击叉号关闭
    
是否养成 = False
def 精灵养成():
    """精灵养成"""
    global 是否养成
    if(Fun("HFVSM","HFVSM_39") != 1):       #太空站页--好友图标上方的小区域
        if(Fun("HFVSM","HFVSM_35") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_36")             #点击星际地图
        if(Fun("HFVSM","HFVSM_37") == 1):       #地图页--太空站图标
            Fun("HFVSM","HFVSM_38")             #点击进入太空站
    elif(Fun("HFVSM","HFVSM_39") == 1):
        if 是否养成 == False:
            Fun("HFVSM","HFVSM_59")             #任何页--点击养成按钮
    
    if(Fun("HFVSM","HFVSM_60",0) == 1):     #精灵养成页--选择杰丹
        pass
    if(Fun("HFVSM","HFVSM_62") == 1):       #精灵养成页--上方文字(天)
        Fun("HFVSM","HFVSM_61")             #点击天赋栏
    if(Fun("HFVSM","HFVSM_63") == 1):       #精灵养成页--中间普通养成(图标)
        Fun("HFVSM","HFVSM_64")             #点击普通养成按钮
    if(Fun("HFVSM","HFVSM_65") == 1):       #精灵养成页--天赋改变页--文字(变为)
        Fun("HFVSM","HFVSM_66")             #点击关闭叉号
    if(Fun("HFVSM","HFVSM_67") == 1):       #精灵养成页--中间高级养成(图标)
        Fun("HFVSM","HFVSM_68")             #点击关闭叉号
        是否养成 = True

是否强化刻印 = False
轮询数 = 0
def 强化刻印():
    """强化刻印时"""
    global 是否强化刻印
    global 轮询数
    if(Fun("HFVSM","HFVSM_39") != 1):       #太空站页--好友图标上方的小区域
        if(Fun("HFVSM","HFVSM_35") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_36")             #点击星际地图
        if(Fun("HFVSM","HFVSM_37") == 1):       #地图页--太空站图标
            Fun("HFVSM","HFVSM_38")             #点击进入太空站
    elif(Fun("HFVSM","HFVSM_39") == 1):
        if 是否强化刻印 == False:
            Fun("HFVSM","HFVSM_69")             #点击背包按钮
    
    if(Fun("HFVSM","HFVSM_15") == 1):       #背包页--左下黄字(战)
        if 是否强化刻印 == False:
            Fun("HFVSM","HFVSM_70")             #点击刻印中心
        if 是否强化刻印 == True:
            Fun("HFVSM","HFVSM_16")         #点击关闭背包叉号
    
    if(Fun("HFVSM","HFVSM_86") == 1):       #刻印强化页--上方黄字(中)
        if(Fun("HFVSM","HFVSM_88") == 1):   #刻印强化页--弹窗(已经是最高等级了)
            Fun("HFVSM","HFVSM_89")         #点击确认按钮
        if 是否强化刻印 == True:
            Fun("HFVSM","HFVSM_87")         #点击叉号关闭
        if(Fun("HFVSM","HFVSM_80") == 1 or Fun("HFVSM","HFVSM_90") == 1):       #刻印强化页--中间黄字(LV.0)
            轮询数 = 9
            Fun("HFVSM","HFVSM_81")             #点击升级刻印
        
        if 轮询数 == 0:
            Fun("HFVSM","HFVSM_71")#1
            轮询数 = 轮询数 + 1
        elif 轮询数 == 1:
            Fun("HFVSM","HFVSM_72")#2
            轮询数 = 轮询数 + 1
        elif 轮询数 == 2:
            Fun("HFVSM","HFVSM_73")#3
            轮询数 = 轮询数 + 1
        elif 轮询数 == 3:
            Fun("HFVSM","HFVSM_74")#4
            轮询数 = 轮询数 + 1
        elif 轮询数 == 4: 
            Fun("HFVSM","HFVSM_75")#5
            轮询数 = 轮询数 + 1
        elif 轮询数 == 5: 
            Fun("HFVSM","HFVSM_76")#6
            轮询数 = 轮询数 + 1
        elif 轮询数 == 6: 
            Fun("HFVSM","HFVSM_77")#7
            轮询数 = 轮询数 + 1
        elif 轮询数 == 7: 
            Fun("HFVSM","HFVSM_78")#8
            轮询数 = 轮询数 + 1
        elif 轮询数 == 8: 
            Fun("HFVSM","HFVSM_79")#右
            轮询数 = 0
        if(Fun("HFVSM","HFVSM_82") == 1):       #刻印强化页--弹窗(本次升级刻印...)
            Fun("HFVSM","HFVSM_83")             #点击确认按钮
        if(Fun("HFVSM","HFVSM_84") == 1):       #刻印强化页--弹窗(你成功将...)
            Fun("HFVSM","HFVSM_85")             #点击确认按钮
            是否强化刻印 = True
        
def 六界神王殿():
    """六界神王殿"""
    if(Fun("HFVSM","HFVSM_92") != 1):           #资源区页--勇者之塔上方小图标
        if(Fun("HFVSM","HFVSM_35") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_36")             #点击星际地图
        if(Fun("HFVSM","HFVSM_37") == 1):       #地图页--太空站图标
            Fun("HFVSM","HFVSM_91")             #点击资源区
    elif(Fun("HFVSM","HFVSM_92") == 1):
        x = task.getRunTask("0043")             #检查模块是不是已经运行完毕
        if x == None:
            task.addTask("0043")

def 泰坦源脉():
    """泰坦源脉"""
    if(Fun("HFVSM","HFVSM_92") != 1):           #资源区页--勇者之塔上方小图标
        if(Fun("HFVSM","HFVSM_35") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_36")             #点击星际地图
        if(Fun("HFVSM","HFVSM_37") == 1):       #地图页--太空站图标
            Fun("HFVSM","HFVSM_91")             #点击资源区
    elif(Fun("HFVSM","HFVSM_92") == 1):
        x = task.getRunTask("0045")             #检查模块是不是已经运行完毕
        if x == None:
            task.addTask("0045")

许愿完成 = False
def 许愿():
    """许愿"""
    global 许愿完成
    if(Fun("HFVSM","HFVSM_93") == 1):       #游戏主页--星愿界面标题字(瓶)
        if 许愿完成 == False:
            Fun("HFVSM","HFVSM_96")             #点击漂流瓶
        else:
            Fun("HFVSM","HFVSM_94")             #点击叉号关闭
    elif(Fun("HFVSM","HFVSM_93") != 1):
        if 许愿完成 == False:
            Fun("HFVSM","HFVSM_95")             #点击许愿活动
    
    if(Fun("HFVSM","HFVSM_97") == 1):       #许愿活动页--边缘花纹图案
        Fun("HFVSM","HFVSM_98")             #点击培养道具
        Fun("HFVSM","HFVSM_99")             #点击开始许愿
    
    if(Fun("HFVSM","HFVSM_100") == 1):      #许愿活动页--弹窗(许愿失败...)
        Fun("HFVSM","HFVSM_101")            #点击确认按钮
    
    if(Fun("HFVSM","HFVSM_102") == 1):      #许愿活动页--弹窗(已经放入...)
        Fun("HFVSM","HFVSM_103")            #点击确认按钮
    
    if(Fun("HFVSM","HFVSM_104") == 1):      #许愿活动页--右下方灰色字(开始)
        Fun("HFVSM","HFVSM_105")            #点击叉号
        许愿完成 = True
    
    if(Fun("HFVSM","HFVSM_106") == 1):      #许愿活动页--弹窗(前置条件不满足)
        Fun("HFVSM","HFVSM_107")            #点击确认按钮
    
    if(Fun("HFVSM","HFVSM_121") == 1):      #许愿活动页--弹窗(许愿成功)
        Fun("HFVSM","HFVSM_122")            #点击确认按钮

def 送巅峰自由():
    """送巅峰自由"""
    if(Fun("HFVSM","HFVSM_109") != 1):          #巅峰圣战页--精灵排行右边图标
        if(Fun("HFVSM","HFVSM_35") == 1):       #游戏主页--星际地图图标
            Fun("HFVSM","HFVSM_108")            #点击巅峰圣战活动
    elif(Fun("HFVSM","HFVSM_109") == 1):
        Fun("HFVSM","HFVSM_110")                #点击中间圣战
    
    if(Fun("HFVSM","HFVSM_111") == 1):          #选择模式页--自由图标
        Fun("HFVSM","HFVSM_112")                #点击自由模式
    
    if(Fun("HFVSM","HFVSM_113") == 1):          #自由战页--上方白色标题(战)
        Fun("HFVSM","HFVSM_114")                #点击创建房间
    
    if(Fun("HFVSM","HFVSM_115") == 1):          #创建房间页--中下方单精灵图标(灰)
        Fun("HFVSM","HFVSM_116")                #点击单精灵模式
    
    if(Fun("HFVSM","HFVSM_117") == 1):          #创建房间页--中下方单精灵图标(亮)
        Fun("HFVSM","HFVSM_118")                #点击创建房间
    
    if(Fun("HFVSM","HFVSM_119") == 1):          #战斗页--弹窗(创建房间成功)
        Fun("HFVSM","HFVSM_120")                #点击确认按钮
    
    #没做完
    